Skip to content

Use Luminance instead of R and RG for single and dual channel images#2745

Merged
riccardobl merged 2 commits into
jMonkeyEngine:masterfrom
riccardobl:fixregression2
May 8, 2026
Merged

Use Luminance instead of R and RG for single and dual channel images#2745
riccardobl merged 2 commits into
jMonkeyEngine:masterfrom
riccardobl:fixregression2

Conversation

@riccardobl
Copy link
Copy Markdown
Member

@riccardobl riccardobl commented May 8, 2026

Fixes https://hub.jmonkeyengine.org/t/jme-3-10-0-alpha4/49585/7

The shared image is 16-bit grayscale. The new loader tries to preserve non-8-bit images instead of converting them to 8-bit, so this image ended up being loaded as R16F.

Historically, jME loaded grayscale images as Luminance8, which behaves like an R8 texture with the red channel replicated into G and B. That is why the rendering looked different.

This PR changes the loader to use Luminance16F for this case, so the previous grayscale behavior is restored while still keeping the higher bit depth.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

🖼️ Screenshot tests have failed.

The purpose of these tests is to ensure that changes introduced in this PR don't break visual features. They are visual unit tests.

📄 Where to find the report:

⚠️ If you didn't expect to change anything visual:
Fix your changes so the screenshot tests pass.

If you did mean to change things:
Review the replacement images in jme3-screenshot-tests/build/changed-images to make sure they really are improvements and then replace and commit the replacement images at jme3-screenshot-tests/src/test/resources.

If you are creating entirely new tests:
Find the new images in jme3-screenshot-tests/build/changed-images and commit the new images at jme3-screenshot-tests/src/test/resources.

Note; it is very important that the committed reference images are created on the build pipeline, locally created images are not reliable. Similarly tests will fail locally but you can look at the report to check they are "visually similar".

See https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-screenshot-tests/README.md for more information

Contact @richardTingle (aka richtea) for guidance if required

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the StbImageLoader to use Luminance16F and Luminance16FAlpha16F formats for 16-bit or floating-point images with one or two channels. It also introduces a new screenshot test, TestSingleChannelTexture, to verify the loading of single-channel PNG textures. I have no feedback to provide.

@riccardobl riccardobl changed the title Use Luminance instead of R for single and dual channel immages Use Luminance instead of R and RG for single and dual channel immages May 8, 2026
@riccardobl riccardobl merged commit 1856c92 into jMonkeyEngine:master May 8, 2026
13 checks passed
@riccardobl riccardobl changed the title Use Luminance instead of R and RG for single and dual channel immages Use Luminance instead of R and RG for single and dual channel images May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant